import { reqgetCategoryData } from "@/api";

//测试
const state={
	categoryData: []
}
const mutations={
	GETCATEGORYLIST(state, categoryData) {
		state.categoryData = categoryData;
		console.log('state',categoryData)
	},
}
const actions = {
	async getCategoryList({ commit }) {
		//reqgetCategoryList返回的是一个Promise对象
		//需要用await接受成功返回的结果，await必须要结合async一起使用（CP）
		const result = await reqgetCategoryData();
		
		if (result.code == 200) {
			// console.log(result.categoryData)
			commit("GETCATEGORYLIST", result.categoryData.北京);
		}
	}
	
}
const getters={
	
}
export default {
	state,
	mutations,
	actions,
	getters
}